package disanzhou;

public class AnyArea{
    final double PI=3.14;
    public static void main(String[] args) {
        AnyArea are =new AnyArea();
        System.out.println("圆的面积");
        System.out.println(are.getArea(2.0));

        //矩形面积
        System.out.println("矩形的面积");
        System.out.println(are.getArea(4.0,5.0));


        //求梯形面积
        System.out.println("梯形的面积");
        System.out.println(are.getArea(2.0,5.0,4.0));
    }
    //传入半径：求圆的面积

    public double getArea(double radius) {
        return PI*radius*radius;
    }

    public double getArea(double wide,double height) {
        return wide*height;
    }

    public double getArea(double s,double x,double h){
        return  ((s+x)*h)/2;
    }
}

